<template>
  <div class="app-container">
    <el-form ref="form" :model="form" style="margin-top: 6px;" size="small" label-width="90px">
      <el-form-item label="下载连接" prop="url">
        <el-input v-model="form.url" style="width: 845px;"/>
      </el-form-item>
      <el-form-item label="">
        <el-button :loading="loading" size="medium" type="primary" @click="doSubmit">生成</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
    import {installWebPage1} from "@/api/InstallWebPage"
    import {downloadFileFunction} from "@/api/downloadFile"

    export default {
        data() {
            return {
                url: '',
                // 新窗口的引用
                newWin: null,
                loading: false,
                form: {
                    url: ''
                },
            }
        },
        methods: {
            doSubmit() {
                this.loading = true;
                installWebPage1({
                        url: this.form.url
                    }
                ).then(res => {
                    this.loading = false;
                    console.log(res);
                    downloadFileFunction(res, this.form.moduleName + `.zip`);
                }).catch(err => {
                    this.loading = false;
                    console.log(err);
                })
            }
        }
    }
</script>
